<?php
/* 
 *  Copyright 2010 Andrew Rickmann
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * This file will run the database installation script against the test database specified in the connection settings.
 *
 *
 *
 */
function application_autoload($classname){
	$path = APPLICATION_PATH . "/../classes" . DIRECTORY_SEPARATOR;
	$file = $path . $classname . '.php';
	if( file_exists($file) ){
		include_once($file);
	}
}

//setup the class autoloader
spl_autoload_register('application_autoload');

//by defining the test folder as the application path we are telling the db class
//to look here for the db connection information, instead of where it would normally be.
define('APPLICATION_PATH' , dirname(__FILE__) );

$db = new databaseconnection();

$sql = file_get_contents(APPLICATION_PATH . '/installscripts/installation_script.sql');
$db->exec( $sql );
?>
